package com.qingcheng.service.impl;

import com.qingcheng.service.goods.CategoryService;
import com.qingcheng.service.goods.SkuService;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author 岳剑飞
 * @Company http://www.ithiema.com
 */
@Component
public class Init implements InitializingBean {

    @Autowired
    private CategoryService categoryService;

    @Autowired
    private SkuService skuService;

    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("缓存预热*****");
        categoryService.saveCategoryTreeToRedis();
        skuService.saveAllPriceToRedis();  //加载价格数据

     //  skuService.importToEs();  //初始化索引
    }
}
